using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableTitleDao:DaoBase<TableTitle>
    {
        public override void AddPrimaryIndex(TableTitle model)
        {
            cachePrimary[model.titleId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableTitle.txt";
        }

        protected override TableTitle ParseRowData(string[] rowData)
        {
            TableTitle data = new TableTitle();
			data.titleId = rowData [0];
			data.type = rowData [1];
			data.titleName = rowData [2];
			data.titleIcon = rowData [3];
			data.titleSimpDesc = rowData [4];

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.param = 0;
            }
            else
            {
                data.param = int.Parse(rowData[5]);
            }
			data.effects = rowData [6];

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.effectTime = 0;
            }
            else
            {
                data.effectTime = int.Parse(rowData[7]);
            }

            return data;
        }



    }

}
